package com.zto.sch.base.normal;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2021-04-21 17:55
 **/
public class LombokTest {
    @Test
    public void test() {
        List<Person> persons = new ArrayList<>();
        Person p1 = new Person(1, "a");
        Person p2 = new Person(2, "b");
        Person p3 = new Person(3, "c");
//        Person p4 = new Person(1, "aa");
        persons.add(p1);
        persons.add(p2);
        persons.add(p3);
//        persons.add(p4);

        System.out.println(persons);

        Map<Integer, String> map = persons.stream().collect(Collectors.toMap(Person::getAge, Person::getName));
        System.out.println(map);
    }

    @Test
    public void test2() {
        int value = Stream.of(1, 2, 3, 4).reduce(100, (sum, item) -> sum + item);
        System.out.println(value);
    }

    @Test
    public void test3() {
        String s = "2%";
        System.out.println("2%".equals(s));
    }

    @Test
    public void test4() {
        List<Integer> collect = Stream.of(1, 2, 3, 4, 5, 6, 7).limit(4).collect(Collectors.toList());
        System.out.println(collect);
    }

}
